﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection.Emit;
using System.Reflection;
using System.Diagnostics.Contracts;
using System.Diagnostics.CodeAnalysis;

namespace Isuka.Cola.Auxiliaries
{
    public sealed class ArgumentInfo
    {
        public ArgumentInfo()
        {
            Attributes = new List<CustomAttributeBuilder>();
        }

        public Type Type { get; set; }

        public string Name { get; set; }

        public List<CustomAttributeBuilder> Attributes { get; private set; }

        public ParameterAttributes ParamAttributes { get; set; }

        public bool ByRef { get; set; }

        #region ObjectInvariant

        [ContractInvariantMethod]
        [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Required for code contracts.")]
        private void ObjectInvariant()
        {
            Contract.Invariant(Attributes != null);
        }


        #endregion
    }

    public sealed class DelegateTypeInfo
    {
        public List<CustomAttributeBuilder> Attributes { get; private set; }

        public Type ResultType { get; set; }

        public string Name { get; set; }

        public List<ArgumentInfo> Arguments { get; private set; }

        public DelegateTypeInfo()
        {
            Attributes = new List<CustomAttributeBuilder>();
            Arguments = new List<ArgumentInfo>();
        }

        #region ObjectInvariant

        [ContractInvariantMethod]
        [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Required for code contracts.")]
        private void ObjectInvariant()
        {
            Contract.Invariant(Attributes != null);
            Contract.Invariant(Arguments != null);
        }

        #endregion

    }
}
